using System;
using System.Collections.Generic;
using RFS.BizLogic.PaiShi.Accounting;
using RFS.BizLogic.Sys.impl;
using RFS.Domain.PaiShi;
using RFS.Domain.PaiShi.Accounting;
using RFS.Domain.PaiShi.WorkFlow;
using ycx;

namespace RFS.BizLogic.PaiShi.Ports.Adapters
{
    /*
     *
 交易序号：20230101505173- jy1
供货单号:   61401146003032402923 - gh1
供货批次： 63681439 - gp1
     */
 
    public class RepoTestData : IRepoPaiShi
    {
        public IEnumerable<dynamic> GetJsonDataSet(BizFlowNodeEnum dn, DateTime bd, DateTime ed = default)
        {
            if (dn == BizFlowNodeEnum.JiaoYi) return GetJiaoYi();
            if (dn == BizFlowNodeEnum.FaHuo) return GetFahuo();
            if (dn == BizFlowNodeEnum.FanKui) return GetFanKui();
            if (dn == BizFlowNodeEnum.GongHuo) return GetGongHuo();
            if (dn == BizFlowNodeEnum.YanShou) return GetGongHuo();
            if (dn == BizFlowNodeEnum.JeiShuan) return GetJeiShuan();
            if (dn == BizFlowNodeEnum.LiuPai) return GetLiuPai();
            if (dn == BizFlowNodeEnum.Tousu) return GetTouSu();
            // if (dn == BizFlowNodeEnum.YanShou) return GetTouSu();


            throw new Exception("not implemte get dataset");
        }

        public IEnumerable<dynamic> GetJsonDataSetTotal(BizFlowNodeEnum dn, DateTime bd = default, DateTime ed = default)
        {
            throw new NotImplementedException();
        }

        public void TryInit()
        {
            throw new NotImplementedException();
        }

        public IEnumerable<dynamic> ExecuteSqlQuery(string querysql)
        {
            throw new NotImplementedException();

             
        }

        public IEnumerable<dynamic> GetJiaoYiPrice(DateTime today)
        {
            throw new NotImplementedException();
        }

        public IEnumerable<dynamic> GetUnRecordedInAccJsonDataSet(BizFlowNodeEnum jiaoYi, AccountPeriod period)
        {
            // 30330|粉红雪山|50
            var json = @"
[
  {
    ""id"": ""1"",
    ""创建时间"": ""2024-12-24 08:15:17"",
    ""供货来源"": ""8"",
    ""供货批次"": ""gp1_unrecorded"",
    ""供货单号"": ""gh1_unrecorded"",
    ""供货商"": ""30330"",
    ""名称"": ""虎嗅花卉"",
    ""品种"": ""粉红雪山"",
    ""供货底价"": ""0.15"",
    ""数量"": ""160"",
    ""等级"": ""A"",
    ""瑕疵A"": """",
    ""瑕疵B"": """",
    ""瑕疵C"": """",
    ""长度"": ""50"",
    ""成熟度"": ""2"",
    ""重量"": """"
  }
]
";

            var ds = json.ToObject<dynamic>();
            return ds;

        }

        public IDayBasedWorkFlowNodeAccountingVoucherSetWrapper GetAVS(AccountPeriod perio)
        {

            var r = new DayBasedWorkFlowNodeAccountingVoucherSetWrapper( );

            var nl = r.LeftNode.WorkFlowNode as WorkFlowNode;
             
            
            nl.OrderItems = new List<IOrderItem>()
            {
                new OrderItem()
                {
                    BizId = "test ni",
                    Product = new Product("1","n","12") 
                }
            };
            
            return r;
        }

        public void SaveRecordedOrderIds(AVSEntity o)
        {
            throw new NotImplementedException();
        }

        public void DeleteRecordedOrderIds(ulong avsId)
        {
            throw new NotImplementedException();
        }

        public IEnumerable<dynamic> GetJiaoYi()
        {
            var json = @"
[
  {
    ""id"": ""1"",
    ""日期"": ""2024-12-29"",
    ""供货批次"": ""gp1"",
    ""交易批次"": ""jy1"",
    ""状态"": ""0"",
    ""供货单号"": ""gh1"",
    ""台车号"": ""7164"",
    ""位置号"": ""A"",
    ""供货代码"": ""30347"",
    ""供货名称"": ""虎嗅花卉"",
    ""品种代码"": ""2127"",
    ""品种名称"": ""粉红雪山"",
    ""品类代码"": ""111"",
    ""品类名称"": ""玫瑰"",
    ""供货底价"": ""0000.15"",
    ""物资代码"": ""511"",
    ""物资名称"": ""桶"",
    ""数量"": ""120"",
    ""等级"": ""C"",
    ""缺陷A"": """",
    ""缺陷B"": """",
    ""长度"": ""55""
  },
  {
    ""id"": ""2"",
    ""日期"": ""2024-12-29"",
    ""供货批次"": ""gp2"",
    ""交易批次"": ""jy2"",
    ""状态"": ""0"",
    ""供货单号"": ""gh2"",
    ""台车号"": ""7164"",
    ""位置号"": ""A"",
    ""供货代码"": ""30322"",
    ""供货名称"": ""虎嗅花卉"",
    ""品种代码"": ""2488"",
    ""品种名称"": ""艾莎"",
    ""品类代码"": ""111"",
    ""品类名称"": ""玫瑰"",
    ""供货底价"": ""0000.15"",
    ""物资代码"": ""511"",
    ""物资名称"": ""桶"",
    ""数量"": ""220"",
    ""等级"": ""C"",
    ""缺陷A"": """",
    ""缺陷B"": """",
    ""长度"": ""50""
  }
]

";

            var ds = json.ToObject<dynamic>();
            return ds;
        }


        public IEnumerable<dynamic> GetFahuo()
        {
            var json = @"

[
  {
    ""id"": ""1"",
    ""创建时间"": ""2024-12-23 06:35:42"",
    ""供货单"": ""gh1"",
    ""供货商"": ""30330"",
    ""供货商名称"": ""虎嗅花卉"",
    ""品类"": ""111"",
    ""品类名称"": ""玫瑰"",
    ""品种"": ""2127"",
    ""品种名称"": ""粉红雪山"",
    ""瑕疵1"": "":"",
    ""优势"": "":"",
    ""长度"": ""50"",
    ""开放度"": ""2"",
    ""等级"": ""C"",
    ""扎数"": ""5"",
    ""状态"": ""录入"",
    ""质检员"": ""14800:虎嗅花卉"",
    ""质检时间"": ""2024-12-22 09:33:11""
  }
]

";

            var ds = json.ToObject<dynamic>();
            return ds;
        }


        public IEnumerable<dynamic> GetFanKui()
        {// pc== gh , not gou huo pic
            var json = @"
[
  {
    ""id"": ""1"",
    ""创建时间"": ""2024-12-23T20:17:31"",
    ""批次"": ""gh1"",
    ""品种"": ""2488"",
    ""扎数"": ""14改为7"",
    ""瑕疵1"": """",
    ""瑕疵2"": """",
    ""优势"": """",
    ""长度"": ""45"",
    ""开放度"": ""2"",
    ""等级"": ""D""
  }
]
";

            var ds = json.ToObject<dynamic>();
            return ds;
        }


        public IEnumerable<dynamic> GetGongHuo()
        {
            var json = @"
[
  {
    ""id"": ""1"",
    ""创建时间"": ""2024-12-24 08:15:17"",
    ""供货来源"": ""8"",
    ""供货批次"": ""gp1"",
    ""供货单号"": ""gh1+"",
    ""供货商"": ""28282"",
    ""名称"": ""虎嗅花卉"",
    ""品种"": ""雪山"",
    ""供货底价"": ""0.15"",
    ""数量"": ""160"",
    ""等级"": ""A"",
    ""瑕疵A"": """",
    ""瑕疵B"": """",
    ""瑕疵C"": """",
    ""长度"": ""65"",
    ""成熟度"": ""2"",
    ""重量"": """"
  }
]
";

            var ds = json.ToObject<dynamic>();
            return ds;
        }


        public IEnumerable<dynamic> GetJeiShuan()
        {
            var json = @"
[
  {
    ""id"": ""1"",
    ""创建时间"": ""2024-12-24 08:15:27"",
    ""日期"": ""2024-12-23"",
    ""交易序号"": ""jy1"",
    ""供货商"": ""28282"",
    ""名称"": ""虎嗅花卉"",
    ""品种"": ""混单玫瑰"",
    ""供货底价"": ""0.15"",
    ""等级"": ""C"",
    ""瑕疵A"": ""140"",
    ""瑕疵B"": ""120"",
    ""瑕疵C"": """",
    ""长度"": ""70"",
    ""成熟度"": ""2"",
    ""重量"": """",
    ""数量"": ""160"",
    ""价格"": ""0.89"",
    ""成交额"": ""142.4"",
    ""佣金"": ""7.12"",
    ""划账金额"": ""135.28"",
    ""成交类型"": ""0-成交""
  }
]
";

            var ds = json.ToObject<dynamic>();
            return ds;
        }

        
        //no liupai
        public IEnumerable<dynamic> GetLiuPai()
        {
            var json = @"s
[
  {
    ""id"": ""1"",
    ""创建时间"": ""2024-10-25 10:40:30"",
    ""交易序号"": ""jy9"",
    ""交易日期"": ""2024-10-24"",
    ""流拍类型"": ""4-供货商底价流拍"",
    ""流拍意见"": ""5-其它"",
    ""供货商"": ""30344"",
    ""名称"": ""虎嗅花卉"",
    ""品种"": ""洛神"",
    ""供货底价"": ""0.15"",
    ""等级"": ""E"",
    ""瑕疵A"": ""141"",
    ""瑕疵B"": """",
    ""瑕疵C"": """",
    ""长度"": ""50"",
    ""开放度"": ""2"",
    ""重量"": """",
    ""数量"": ""200"",
    ""流拍价格"": ""0.15"",
    ""处理状态"": ""已处理"",
    ""处理方式"": ""3-销毁"",
    ""处理价格"": """",
    ""处理金额"": """",
    ""佣金"": ""0"",
    ""划账金额"": ""2024-10-24"",
    ""处理日期"": """"
  }
]
";

            var ds = json.ToObject<dynamic>();
            return ds;
        }
        
                
        //no ts
        public IEnumerable<dynamic> GetTouSu()
        {
            var json = @"s
[
   {
    ""id"": ""1"",
    ""创建时间"": ""2024-12-24 08:15:37"",
    ""时间"": ""2024-12-23 00:00:00"",
    ""交易号"": ""jy9"",
    ""供货商"": ""28282"",
    ""名称"": ""虎嗅花卉"",
    ""品种"": ""珍爱"",
    ""等级"": ""C"",
    ""瑕疵"": """",
    ""长度"": ""55"",
    ""开放度"": ""2"",
    ""重量"": """",
    ""原成交数量"": ""120"",
    ""原成交价"": ""1.29"",
    ""原成交额"": ""154.8"",
    ""投诉类型"": ""8"",
    ""新品种名"": ""珍爱"",
    ""新等级"": ""C"",
    ""新缺陷"": ""114"",
    ""新长度"": ""55"",
    ""新开放度"": ""2"",
    ""新重量"": ""55"",
    ""处理方式"": ""2-销售"",
    ""处理量"": ""10"",
    ""处理价格"": ""1.29"",
    ""处理金额"": ""12.9"",
    ""供货商佣金"": ""0.65"",
    ""划账金额"": ""12.25""
  }
]
";

            var ds = json.ToObject<dynamic>();
            return ds;
        }
        
        
        
    }
}